// Fill out your copyright notice in the Description page of Project Settings.


#include "UI/HallUI/UMG/UI_HallMenuSystem.h"

#include "Components/Button.h"
#include "Kismet/GameplayStatics.h"
#include "UI/HallUI/UMG/UI_MainHall.h"

void UUI_HallMenuSystem::NativeConstruct()
{
	Super::NativeConstruct();

	// 给按钮添加绑定事件。
	GameStartButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::GameStart);
	SecretTerritoryButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::SecretTerritory);
	HistoryButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::History);
	GameSettingsButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::GameSettings);
	TutorialWebsiteButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::TutorialWebsite);
	BrowserButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::Browser);
	SpecialContentButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::SpecialContent);
	QuiteGameButton->OnClicked.AddDynamic(this, &UUI_HallMenuSystem::QuiteGame);
}

// void UUI_HallMenuSystem::BindGameStart(FOnButtonClickedEvent ClickedEvent)
// {
// 	GameStartButton->OnClicked = ClickedEvent;
// }

void UUI_HallMenuSystem::GameStart()
{
	UGameplayStatics::OpenLevel(GetWorld(), "SelectLevel_Map");
}

void UUI_HallMenuSystem::SecretTerritory()
{
}

void UUI_HallMenuSystem::History()
{
	Owner->History();
}

void UUI_HallMenuSystem::GameSettings()
{
	Owner->GameSettings();
}

void UUI_HallMenuSystem::TutorialWebsite()
{
	Owner->TutorialWebsite();
}

void UUI_HallMenuSystem::Browser()
{
}

void UUI_HallMenuSystem::SpecialContent()
{
}

void UUI_HallMenuSystem::QuiteGame()
{
	UE_LOG(LogTemp, Warning, TEXT("退出游戏！！"))
	// QuiteGame();
	
}

void UUI_HallMenuSystem::SetOwner(UUI_MainHall* NewOwner)
{
	Owner = NewOwner;
}
